<%@page import="com.egame.manage.biz.server.gc.GameFileServiceImpl"%>
<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="cn.egame.interfaces.gc.GameInfo"%>   
<%@page import="cn.egame.interfaces.fl.FileUsedType"%>  
<%@page import="com.egame.manage.biz.server.gc.GameServiceImpl"%>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link type="text/css" rel="stylesheet" href="<%=request.getContextPath() %>/css/main.css"  />
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
function formSubmit(){
	var filepath = $("#uploadFile").val();
	if(filepath==""){
	    alert("请选择上传的文件！");
	    isSubmit = false;
	    return;
	}else {
		var extname = filepath.substring(filepath.lastIndexOf(".")+1,filepath.length);
		extname = extname.toLowerCase();
		if(extname!= "jar"&&extname!= "apk"&&extname!= "cab"&&extname!= "app"){
            alert("请选择jar、apk、cab或app格式的文件！");
            isSubmit = false;
            return;
		}else{
			isSubmit = true;
		}
	} 
	
	if(isSubmit){
		document.getElementById("myform").submit();
	}else{
		return;
	}
}
</script>
<title>上传文件</title>
</head>
<body>
<div class="matter_box">
	<div class="mt10 pt10 clearfix">
<form name="data" id="myform" action="<%=request.getContextPath() + "/tv/game/file/upload.do" %>"  method="post" enctype="multipart/form-data">
	<table class="table2">
	<%
	if(request.getAttribute("bean")!=null){
		GameInfo bean = (GameInfo)request.getAttribute("bean");					
	%>
		<tr>
			<td>厂商简称</td>
			<td><%=GameServiceImpl.getInstance().getContentProviderInfoById(0, 0L, bean.getCpId()).getShortName() %></td>
		</tr>
		<tr>
			<td>游戏代码</td>
			<td><%=bean.getGameCode() %></td>
		</tr>
		<tr>
			<td>产品名称</td>
			<td><%=bean.getGameName() %></td>
		</tr>
		<tr>
			<td>产品ID</td>
			<td><%=bean.getGId() %></td>
		</tr>
		<tr>
			<td>产品提交时间</td>
			<td>
			<% 	
				String insertTime = "";
				if(bean.getInsertTime() != null && bean.getInsertTime().getTime()>0){
					insertTime = cn.egame.common.util.Utils.toDateString(bean.getInsertTime(),"yyyy-MM-dd hh:mm:ss");
				}				
			%>
				<%=insertTime %>
			</td>
		</tr>
		<tr>
			<td>上传实体个数</td>
			<td><%=GameFileServiceImpl.getInstance().getFileCountByGId(bean.getGId()) %></td>
		</tr>
		<tr>
			<td>适配实体个数</td>
			<td><%=GameFileServiceImpl.getInstance().getFileLinkCountByGid(bean.getGId()) %></td>
		</tr>
		<tr>
			<td>上传实体</td>
			<td>
				<input type="file" name="gameFile" id="uploadFile">				
				<input type="hidden" name="file_type" value="<%=FileUsedType.GAME %>">
				<input type="hidden" name="gid" value="<%=bean.getGId() %>">
				<input type=button value="上传" class="btn3" onclick="formSubmit()">
			</td>
		</tr>

	<%				
	}
	%>
	</table>
</form>
</div>
</div>
</body>
</html>